/**
 * Created with JetBrains WebStorm.
 * User: Fred_974
 * Date: 08/03/13
 * Time: 22:56
 * To change this template use File | Settings | File Templates.
 */
/**
 * Created with JetBrains WebStorm.
 * User: Fred_974
 * Date: 08/03/13
 * Time: 22:42
 * To change this template use File | Settings | File Templates.
 */
//coco
var Health = require("./Health");
var Personage = require("./Personage");
var Plantation = require("./Plantation");
var Tile = function Tile(){

}

Tile.prototype = {
    initialize : function() {
        this.id;

        this.coordinateX,
            this.coordinateY,
            this.coordinateZ,
            this.width,
            this.height,
            this.personage,
            this.fertility,
            this.maxFertility,
            this.humidity

    },


    init : function(parameters){
        this.id = parameters.id;

        this.coordinateX = parameters.coordinateX;
        this.coordinateY = parameters.coordinateY;
        this.coordinateZ = parameters.coordinateZ;
        this.fertility =  parameters.fertility;
        this.maxFertility =  parameters.maxFertility;
        this.humidity =  parameters.humidity;
        this.width = parameters.width;
        this.height = parameters.height;



        if(parameters.personage == null){
            this.personage = null;
        }else{

            this.personage = parameters.personage;
        }


    },

    getId : function(){
        return this.id;
    },



    getCoordinateX : function(){
        return this.coordinateX;
    },

    getCoordinateY : function(){
        return this.coordinateY;
    },

    getCoordinateZ : function(){
        return this.coordinateZ;
    },



    getPersonageForPersist : function(){


        if(this.personage == null){

            return null;
        }
        if(this.personage.id == undefined){

            return this.personage;
        }else{
            return this.personage.id;
        }

    }
}

module.exports = Tile;